package com.cy.personer.web;

import com.cy.personer.bean.Combo;
import com.cy.personer.bean.Suggest;
import com.cy.personer.bean.Summary;
import com.cy.personer.biz.ComboBiz;
import com.cy.personer.biz.SuggestBiz;
import com.cy.personer.biz.impl.SuggestBizImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 建议
 */
@Controller
@RequestMapping("/suggest")
public class SuggestHandler {

    @Resource
    SuggestBiz suggestBizImpl;

    // 修改建议
    @RequestMapping(value = "/updateSuggest.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String updateSuggest(Suggest suggest){
        return ""+suggestBizImpl.updateSuggest(suggest);
    }

    //新增建议
    @RequestMapping(value = "/addSuggest.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String addSuggest(Suggest suggest){
        return ""+suggestBizImpl.addSuggest(suggest);
    }

    //查找建议列表
    @RequestMapping(value = "/getSuggests.action", method= RequestMethod.POST, produces="application/json;charset=utf-8")
    public @ResponseBody
    PageInfo<Suggest> getSuggests(Suggest suggest,int pageNum){
        return suggestBizImpl.getSuggests(suggest,pageNum);
    }

    //查找建议
    @RequestMapping(value = "/getSuggest.action", method= RequestMethod.POST, produces="application/json;charset=utf-8")
    public @ResponseBody
    Suggest getSuggest(Suggest suggest){
        return suggestBizImpl.getSuggest(suggest);
    }

    /**
     * 删除建议
     * @author 林少艺
     */
    @RequestMapping(value = "/delSuggest.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String delSuggest(Suggest suggest){
        return ""+ suggestBizImpl.delSuggest(suggest);
    }
}
